
using System.Collections.Generic;
using System;
using UnityEngine;
using UnityEditor;
using SgsUI;

namespace SgsUI.Editor
{
    [CustomEditor(typeof(ViewCanvas))]

    public class ViewCanvasEditor : UnityEditor.Editor
    {
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            serializedObject.Update();

            if (GUILayout.Button("output lua"))
            {
                ViewCanvas mySelf = target as ViewCanvas;
                mySelf.OutputLua();
            }

            if (GUILayout.Button("input from json"))
            {
                ViewCanvas mySelf = target as ViewCanvas;
                string path = EditorUtility.OpenFilePanel("Select Json File", "psdImport/output", "json");
                if(path != "")
                {
                    mySelf.InputLua(path);
                }
            }
        }
    }
}